﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CommentList.ascx.cs" Inherits="admin_webparts_Plug_ins_Comment_CommentList" %>
<%@ Import Namespace="NTTHAO.Web.BL.CommonPage" %>
<%@ Import Namespace="NTTHAO.Common.BL" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<div class="tip">
	<h1>Comment list</h1>
    <div style="display: block; width: 32px; height: 32px; float: right; position: relative; top: -27px;"><a title="<%=LanguageUtility.GetLanguageText("CLICK_RETURN", Session) %>" href="?type=<%=Request.QueryString["type"] %>"><img src="resources/images/Back.png" alt="" /></a></div>
</div>
<div style="border: solid 1px #89F;padding: 5px;margin-bottom: 10px;">
    <div style="overflow: hidden;font-weight: bold; padding-left: 2px;">
        <span><%=LanguageUtility.GetLanguageText("TOTAL") %>: <span style="color: #E76300;"><%=_TotalItem %></span> <%=LanguageUtility.GetLanguageText("ITEMS") %>.</span> <%if (_TotalItem > 1) { %>
        <span><%=LanguageUtility.GetLanguageText("VIEW")%>: <span style="color: #E76300;"><%=(_PageNo - 1) * PAGE_SIZE + 1%> - <%= ((_PageNo - 1) * PAGE_SIZE + (_List == null ? 0 : _List.Rows.Count))%></span></span>
        <%} %>
    </div>
<%if (_PageCount > 1) { %>
    <div style="overflow: hidden; padding-top: 10px;">
        <div class="boxPaging">
            <div class="pagenum f-left">
                <ul>
                    <li><a class="first" href="<%=this._PageUrl + "page=1" %>">|&lt;&nbsp;Đầu</a></li>
                    <li><a class="pre" href="<%=this._PageUrl + "page=" + (this._PageNo <= 1 ? 1 : (this._PageNo - 1)) %>">&lt;</a></li>
                    <%
                        int startPage = _PageNo - 4;
                        if (startPage > _PageCount - 9)
                        {
                            startPage = _PageCount - 9;
                        }
                        if (startPage < 1)
                        {
                            startPage = 1;
                        }
                        for (int i = startPage; i <= _PageCount && i < (startPage + 10); i++)
                        {
                    %>
                    <li <%=(i == _PageNo ? "class=\"selected\"" : "") %>><a href="<%=this._PageUrl + "page=" + i.ToString() %>"><%=i %></a></li>
                    <%   
                        }
                    %>
                    <li><a class="next" href="<%=this._PageUrl + "page=" + (this._PageNo >= this._PageCount ? this._PageCount : (this._PageNo + 1)) %>">&gt;</a></li>
                    <li><a class="last" href="<%=this._PageUrl + "page=" + this._PageCount.ToString() %>">Cuối&nbsp;&gt;|</a></li>
                </ul>
            </div>
        </div>
    </div>
<%} %>
</div>
<table border="1" cellpadding="0" cellspacing="0" class="grid" id="tbGrid">
    <tr>
        <th width="42px">#</th>
        <th>Name/Email</th>
        <th>Comment</th>
        <th>Content</th>
        <th width="32px">&nbsp;</th>
    </tr><%
    if (this._List != null) for (int i = 0; i < this._List.Rows.Count; i++)
    {
        System.Data.DataRow row = this._List.Rows[i];
        int id = (int)row[ContentComment.ID__COLUMN_NAME];
        string name = row[ContentComment.NAME__COLUMN_NAME].ToString();
        string email = row[ContentComment.EMAIL__COLUMN_NAME].ToString();
        string comment = row[ContentComment.COMMENT__COLUMN_NAME].ToString().Replace(Environment.NewLine, "<br />");
        string content = row["Header"].ToString();
%>
    <tr>
        <td align="center"><%=i + 1 %></td>
        <td align="left"><div style="padding: 3px 0px;"><b><%=name %></b><br /><%=email %></div></td>
        <td align="left"><div style="padding: 3px 0px;"><%=comment%></div></td>
        <td align="left"><%=content%></td>
        <td align="left">
            <ul class="icon" style="width: 28px;">
                <li><a title="<%=LanguageUtility.GetLanguageText("DELETE", Session)%>" href="<%=this.GetDeleteUrl(id) %>" class="icon deletebn" onclick="javascript: return confirmDelete();">&nbsp</a></li>
            </ul>
        </td>
    </tr><%
    } %>
</table>
<script type="text/javascript">
    function confirmDelete() {
        var msg = '<%=LanguageUtility.GetLanguageText("CONFIRM_DELETE", Session).Replace(Environment.NewLine, "<br />")%>';
        return confirm(msg.replace(/<br \/>/gi, "\r\n").replace(/<br\/>/gi, "\r\n"));
    }
</script>